﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Xml.Linq;
using System.Xml;
using System.Xml.XPath;
using System.Globalization;
using System.Net;
using System.IO;


namespace BuienradarAppWeb.Pages
{
    public partial class BuienradarAppPart : Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

            string width = "256";
            string height = "256";
            string country = "nl";
            string city = "Eindhoven";
            string postalcode = "5653PX";
            decimal widthFrame = 226;
            decimal heightFrame = 226;

            try
            {
                width = Request.QueryString["width"];
                height = Request.QueryString["height"];
                country = Request.QueryString["country"];
                //city = Request.QueryString["city"];
                //postalcode = Request.QueryString["postalcode"];
                widthFrame = decimal.Parse(width) - 30;
                heightFrame = decimal.Parse(height) - 30;


                String buienradarHandlerUrl = String.Format(@"Buienradar.ashx?width={0}&height={1}&country={2}&city={3}&postalcode={4}",
                                                                widthFrame, heightFrame, country, "", "");
                
                 litBuienradar.Text = String.Format(@"
                        <IFRAME 
                            SRC ={0}
                            NORESIZE 
                            SCROLLING=NO 
                            HSPACE=0 
                            VSPACE=0 FRAMEBORDER=0 MARGINHEIGHT=0 MARGINWIDTH=0 
                            WIDTH={1} 
                            HEIGHT={2}>
                        </IFRAME>", buienradarHandlerUrl, widthFrame.ToString(), heightFrame.ToString());
                
            }
            catch (Exception ex)
            {
                litBuienradar.Text = "Er ging iets mis: " + ex.Message;

            }


        }
    }
}